package com.ly.lypopupwindowdemo.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.ly.lypopupwindowdemo.R;

public class CustomViewActivity extends AppCompatActivity implements View.OnClickListener {

    Button btn1, btn2, btn3, btn4;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_custom_view);

        btn1 = (Button) findViewById(R.id.btn1);
        btn2 = (Button) findViewById(R.id.btn2);
        btn3 = (Button) findViewById(R.id.btn3);
        btn4 = (Button) findViewById(R.id.btn4);

        findViewById(R.id.btn5).setOnClickListener(this);
        findViewById(R.id.btn6).setOnClickListener(this);
        findViewById(R.id.btn7).setOnClickListener(this);
        findViewById(R.id.btn8).setOnClickListener(this);
        findViewById(R.id.btn9).setOnClickListener(this);
        findViewById(R.id.btn10).setOnClickListener(this);
        findViewById(R.id.btn0).setOnClickListener(this);
        findViewById(R.id.btn11).setOnClickListener(this);
        findViewById(R.id.btn12).setOnClickListener(this);
        findViewById(R.id.btn13).setOnClickListener(this);
        findViewById(R.id.btn14).setOnClickListener(this);

        btn1.setOnClickListener(this);
        btn2.setOnClickListener(this);
        btn3.setOnClickListener(this);
        btn4.setOnClickListener(this);
    }

    public void startActivity(Class c) {
        Intent intent = new Intent(this, c);
        startActivity(intent);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn1: {
                Intent intent = new Intent(CustomViewActivity.this, CountViewActivity.class);
                intent.putExtra("position", 1);
                startActivity(intent);
            }
            break;
            case R.id.btn2: {
                Intent intent = new Intent(CustomViewActivity.this, CountViewActivity.class);
                intent.putExtra("position", 2);
                startActivity(intent);
            }

            break;
            case R.id.btn3: {
                Intent intent = new Intent(CustomViewActivity.this, CountViewActivity.class);
                intent.putExtra("position", 3);
                startActivity(intent);
            }
            break;
            case R.id.btn4: {
                Intent intent = new Intent(CustomViewActivity.this, CountViewActivity.class);
                intent.putExtra("position", 4);
                startActivity(intent);
            }
            break;
            case R.id.btn5:
                startActivity(HongYangView1Activity.class);
                break;
            case R.id.btn6:
                startActivity(HongYangView2Activity.class);
                break;

            case R.id.btn7:
                startActivity(CustomCircleViewActivity.class);
                break;
            case R.id.btn8:
                //自定义进度条
                startActivity(CustomProgressbarActivity.class);
                break;
            case R.id.btn9:
                //带进度的webview
                startActivity(WebViewActivity.class);
                break;
            case R.id.btn10:
                //滚轮
                startActivity(PickerViewActivity.class);
                break;
            case R.id.btn0:
                startActivity(CanvasActivity.class);
                break;
            case R.id.btn11:
                //自定义日历
                startActivity(MyCanalendarActivity.class);
                break;
            case R.id.btn12:
                //三方日历 superCalendar
                startActivity(TheThirdCalendar.class);
                break;
            case R.id.btn13:
                //让数字动起来
                startActivity(NumberDanceActivity.class);
                break;
            case R.id.btn14:
                //https://www.jianshu.com/p/e9d8420b1b9c
                //手把手教你写一个完整的自定义view
                startActivity(CanvasDemoActivity.class);
                break;
            default:
                break;


        }
    }
}
